import {
  login
} from '@/Utils/Urls';
import _fetch from '@/Utils/Fetch'
import _request from '../../Utils/Request';

// 用户登录
export const loginThunk = (telephone, password, roleId) => () => new Promise((resolve, reject) => {
  _fetch({
    url: '/user/manager/login',
    type: "post",
    data: {
      telephone,
      password,
      roleId: Number(roleId)
    },
    isJson: true
  }).then(res => {
    if (res && res.data.code === 200) {
      resolve(res.data);
    } else {
      reject();
    }
  })
})

// 获取发货地址
export const queryAddressThunk = (telephone, password, roleId) => () => new Promise((resolve, reject) => {
  _fetch({
    url: '/user/address/queryAddress',
  }).then(res => {
    if (res && res.data.code === 200) {
      resolve(res.data);
    } else {
      reject();
    }
  })
})


